<?php
namespace  Android\Model;
use Think\Model;

class MessageModel extends Model
{

    public function Message(&$user_id)
    {
        //个人聊天
        $chat = D('chat');
        $info['chat'] = $chat->field('chat.*,nickname')->join('user us on chat.fromuser=us.user_id')->where("user_id=" . $user_id." and status=0")->select();
        //团体聊天
        $join_act= D('join_act');
        $join_actid= $join_act->field('act_id')->where('user_id='.$user_id)->select();
        $grop_Message=D('grop_message');
        //查看参加了活动
         $activity= D('activity');
         $data=time();
        //获取七天后的数据
         $endtime=date('Y-m-d H:i:s', strtotime('7 days'));
         $begintime=date('Y-m-d H:i:s',strtotime(now));
         foreach ($join_actid as $k=>$v){
             $act_id=$v['act_id'];
             $info['act']= $activity->field('gene_time,act_id,theme')->where(" gene_time between '$begintime' and  '$endtime'"." and act_id=".$act_id)->select();
         }

    }
}